package dev.devlok.springcloudstreamzeromqbindersample;

import org.zeromq.SocketType;
import org.zeromq.ZContext;
import org.zeromq.ZMQ;

public class ZeroMqPublisher {
    public static void main(String [] args)
    {
        ZContext zContext = new ZContext();
        ZMQ.Socket socket = zContext.createSocket(SocketType.PUB);
        socket.bind("tcp://localhost:6001");


        for(int i = 0;i< 100; i++) {
            socket.sendMore("input");
            socket.send("ABC");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }

        socket.unbind("tcp://localhost:6001");
        zContext.destroy();

    }
}
